package com.party.mobile.web.dto.photo.output;

import com.google.common.collect.Lists;
import com.party.core.model.photo.PhotosImgInfo;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.List;

/**
 * @Description: 图片详情输出
 * @Author: yangshoukun
 * @Date: 2018/6/5 14:51
 */
public class ImgDetailOutput implements Serializable {

    private static final long serialVersionUID = -8771539366018216706L;

    private String id;

    private String url;
    // 浏览量
    private Integer viewNum;
    // 操作次数
    private Integer operateNum;
    // 从哪个分类点进来的(进入图片详情的分类id)
    private String tagId;
    // 最后更新时间
    private String lastTime;
    // 最后更新人
    private String lastMember;
    // 最后更新人对所有照片的操作次数
    private Integer memberOperateNum;
    // 机构id
    private String partnerId;
    // 相册id
    private String photosId;
    // 照片的所有分类
    private List<TagOutput> tags = Lists.newArrayList();

    public String getId() {
        return id;
    }

    public String getPartnerId() {
        return partnerId;
    }

    public void setPartnerId(String partnerId) {
        this.partnerId = partnerId;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Integer getViewNum() {
        return viewNum;
    }

    public void setViewNum(Integer viewNum) {
        this.viewNum = viewNum;
    }

    public Integer getOperateNum() {
        return operateNum;
    }

    public void setOperateNum(Integer operateNum) {
        this.operateNum = operateNum;
    }

    public String getTagId() {
        return tagId;
    }

    public void setTagId(String tagId) {
        this.tagId = tagId;
    }

    public String getLastTime() {
        return lastTime;
    }

    public void setLastTime(String lastTime) {
        this.lastTime = lastTime;
    }

    public String getLastMember() {
        return lastMember;
    }

    public void setLastMember(String lastMember) {
        this.lastMember = lastMember;
    }

    public Integer getMemberOperateNum() {
        return memberOperateNum;
    }

    public void setMemberOperateNum(Integer memberOperateNum) {
        this.memberOperateNum = memberOperateNum;
    }

    public List<TagOutput> getTags() {
        return tags;
    }

    public void setTags(List<TagOutput> tags) {
        this.tags = tags;
    }

    public String getPhotosId() {
        return photosId;
    }

    public void setPhotosId(String photosId) {
        this.photosId = photosId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ImgDetailOutput)) return false;

        ImgDetailOutput output = (ImgDetailOutput) o;

        if (id != null ? !id.equals(output.id) : output.id != null) return false;
        if (url != null ? !url.equals(output.url) : output.url != null) return false;
        if (viewNum != null ? !viewNum.equals(output.viewNum) : output.viewNum != null) return false;
        if (operateNum != null ? !operateNum.equals(output.operateNum) : output.operateNum != null) return false;
        if (tagId != null ? !tagId.equals(output.tagId) : output.tagId != null) return false;
        if (lastTime != null ? !lastTime.equals(output.lastTime) : output.lastTime != null) return false;
        if (lastMember != null ? !lastMember.equals(output.lastMember) : output.lastMember != null) return false;
        if (memberOperateNum != null ? !memberOperateNum.equals(output.memberOperateNum) : output.memberOperateNum != null)
            return false;
        if (partnerId != null ? !partnerId.equals(output.partnerId) : output.partnerId != null) return false;
        if (photosId != null ? !photosId.equals(output.photosId) : output.photosId != null) return false;
        return tags != null ? tags.equals(output.tags) : output.tags == null;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (url != null ? url.hashCode() : 0);
        result = 31 * result + (viewNum != null ? viewNum.hashCode() : 0);
        result = 31 * result + (operateNum != null ? operateNum.hashCode() : 0);
        result = 31 * result + (tagId != null ? tagId.hashCode() : 0);
        result = 31 * result + (lastTime != null ? lastTime.hashCode() : 0);
        result = 31 * result + (lastMember != null ? lastMember.hashCode() : 0);
        result = 31 * result + (memberOperateNum != null ? memberOperateNum.hashCode() : 0);
        result = 31 * result + (partnerId != null ? partnerId.hashCode() : 0);
        result = 31 * result + (photosId != null ? photosId.hashCode() : 0);
        result = 31 * result + (tags != null ? tags.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "ImgDetailOutput{" +
                "id='" + id + '\'' +
                ", url='" + url + '\'' +
                ", viewNum=" + viewNum +
                ", operateNum=" + operateNum +
                ", tagId='" + tagId + '\'' +
                ", lastTime='" + lastTime + '\'' +
                ", lastMember='" + lastMember + '\'' +
                ", memberOperateNum=" + memberOperateNum +
                ", partnerId='" + partnerId + '\'' +
                ", photosId='" + photosId + '\'' +
                ", tags=" + tags +
                '}';
    }

    public static ImgDetailOutput transform(PhotosImgInfo imgInfo) {
        ImgDetailOutput output = new ImgDetailOutput();
        BeanUtils.copyProperties(imgInfo, output);
        return output;
    }
}
